//Sound manager for DirectX game 
//Use XAudio2 - new standard for DirectX game replace with DirectSound

#ifndef DXGAMESOUND_H
#define DXGAMESOUND_H

#include <map>
#include <xaudio2.h>
#include "game.h"

using namespace game;

class DXGameSound : public GameSound
{	
  public:
    DXGameSound(DWORD = 44100, WORD = 16);
    virtual bool Init();
    virtual bool LoadBackgroundSound(const char*, const char*);
    virtual bool LoadSound(const char*, const char*);
    virtual void UnLoadSound(const char*);
    virtual void Play(const char*);
    virtual void Stop(const char*);
    virtual void Pause(const char*);
    virtual void Resume(const char*);
    virtual ~DXGameSound();
		
  private:
    IXAudio2* pXAudio;											//Pointer to interface XAudio2
    IXAudio2MasteringVoice* pMasteringVoice;					//Pointer to interface MasteringVoice
    WAVEFORMATEX wfx;											//Format of waveform-audio data
    std::map<const char*, IXAudio2SourceVoice*> mSourceVoice;	//Map SourceVoice correspond sound's alias
    std::map<const char*, BYTE*> mSoundData;					//Map sound's data in memory correspond sound's alias
    std::map<const char*, XAUDIO2_BUFFER> mAudioBuffer;			//Map sound's buffer correspond sound's alias
};

#endif